package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dto.ShoppingGoodsDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @Author:WalterChan
 * @Decription:ShoppingGoodsConverter
 * @Date Created in 2023-01-11-11:42
 */
@Mapper(componentModel = "spring")
public interface ShoppingGoodsConverter {
    @Mappings({
            @Mapping(source = "id",target = "productId"),
            @Mapping(source = "image",target = "picUrl"),
            @Mapping(source = "sell_point",target = "subTitle"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "title",target = "productName")
    })
    ShoppingGoodsDto converItem2ShoppingGoodsDto(Item item);
    List<ShoppingGoodsDto> converItem2ShoppingGoodsDtoList(List<Item> list);


}
